// src/schemas/question-group/question-group.schema.ts
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';
export type QuestionGroupDocument = QuestionGroup & Document;
@Schema()
export class QuestionGroup {
  @Prop({ type: Types.ObjectId, ref: 'Material' })
  materialId: Types.ObjectId; // 关联材料

  @Prop([{ 
    type: Types.ObjectId, 
    ref: 'Question',
    required: true 
  }])
  questions: Types.ObjectId[]; // 包含的小题列表

  @Prop({ default: 0 })
  totalScore: number; // 大题总分（自动计算）
}
export const QuestionGroupSchema = SchemaFactory.createForClass(QuestionGroup);
